package com.zkzx.common.truck.constants;

import com.zkzx.common.constants.NationalityEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * @author young Email:yanghui@zkraising.com
 * @description 能源类型
 * @company 北京中科智兴物联科技有限公司 @版权所有
 * @since 2021年05月10日 15时33分
 */
@Getter
@AllArgsConstructor
public enum EnergyEnum {

    GASOLINE("A","汽油"),

    DIESEL_OIL("B","柴油"),

    ELECTRICITY("C","电"),

    MIXED_OIL("D","混合油"),

    NATURAL_GAS("E","天然气"),

    LIQUEFACTION_GASOLINE("F","液化石油气"),

    METHANOL("L","甲醇"),

    ETHANOL("M","乙醇"),

    SUN("N","太阳能"),

    HYBRID("O","混合动力"),

    NO("Y","无"),

    OTHER("Z","其他");

    private String code;

    private String value;

    public static String getNameByCode(final String code){
        return Arrays.stream(EnergyEnum.values()).filter(energy -> energy.getCode().equals(code)).findFirst().map(Enum::name).orElse(null);
    }
}
